<template>
  <div>
    <div class="detail_main">
      <div class="detail_top">
        <h2>提醒人员设置</h2>
      </div>
      <div class="detail_containter">
        <FormPanel :list="formList" :isSubmitBtn="false" @formChange="changeHandle" />
      </div>
    </div>
    <div class="detail_main">
      <div class="detail_top">
        <h2>提醒人员列表</h2>
      </div>
      <div class="detail_containter">
        <FilterTable ref="basetable" :fetchapi="fetchApi" :columns="columns" :params="fetchParams" :datakey="'rows'" :onColumnsChange="columns => (this.columns = columns)"></FilterTable>
        <div
          :style="{
            position: 'absolute',
            left: 0,
            bottom: 0,
            right: 0,
            zIndex: 9999,
            borderTop: '1px solid #e9e9e9',
            padding: '10px 20px',
            background: '#fff',
            textAlign: 'right'
          }"
        >
          <el-button @click="commit">分 派</el-button>
          <el-button @click="closeDialog">返 回</el-button>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      formList: this.createdFrom(),
      fetchApi: () => {},
      columns: this.createdTable()
    };
  },
  methods: {
    createdFrom() {
      return [
        {
          type: 'RADIO',
          label: '分配方式',
          fieldName: 'DEALER_CODE',
          initialValue: 1,
          itemList: [
            { text: '平均分配', value: 1 },
            {
              text: '按归属人',
              value: 2
            }
          ],
          change: props => {
            this.changeRadio(props);
          }
        }
      ];
    },
    createdTable() {
      return [
        {
          title: '序号',
          render: props => {
            return <span>{props.row.index + 1}</span>;
          }
        },
        {
          title: '提醒人员',
          dataIndex: 'BRAND_NAME',
          sorter: true,
          filter: true,
          render: props => {
            return <span>{props.row.BRAND_NAME}</span>;
          }
        }
      ];
    },
    changeRadio(val) {
      console.log(val, '改变');
    },
    changeHandle(val) {},
    commit() {}
  }
};
</script>
<style lang="less" scoped>
.detail_main {
  border: 1px solid #ebeef5;
  margin-bottom: 10px;
  .detail_top {
    background: #f2f2f2;
    border-bottom: 1px solid #ebeef5;
    height: 25px;
    line-height: 25px;
    padding: 0 10px;
    padding-right: 10px;
  }
  .detail_containter {
    padding-top: 10px;
  }
}
</style>
